#ifndef __AVIVIDEOOBJECT_H__
#define __AVIVIDEOOBJECT_H__

#include "IVideoObject.h"
#include "vfw.h"	// Header File For Video For Windows

namespace rkt
{
	class AVIVideoObject_Win32: public IVideoObject
	{
		VideoObjectDesc m_VideoDesc;
		GrabImgDesc	m_imgDesc;
		AVISTREAMINFO		m_aviStreamInfo;					// Pointer To A Structure Containing Stream Info
		PAVISTREAM			m_aviStream;						// Handle To An Open Stream
		PGETFRAME			m_aviPGetFrame;						// Pointer To A GetFrame Object

		HDRAWDIB m_hDD;												// Handle For Our Dib
		HBITMAP m_hBmp;												// Handle To A Device Dependant Bitmap
		HDC m_hDC;													// Memory DC
		unsigned char	* m_imageDataPtr;							//image data pointer	

		const static uint c_suiWidthLimit = 1024;					//grab image width limit
		const static uint c_suiHeightLimit = 768;					//grab image height limit
	public:
		virtual const VideoObjectDesc & getVideoDesc();
		virtual void * grabImage(int frame);
		virtual const GrabImgDesc & getGrabImgDesc();
		virtual void release();
	public:
		AVIVideoObject_Win32();
		bool open(const std::string filename, uint imgWidth, uint imgHeight);
		~AVIVideoObject_Win32();
		void close();
	private:
		void flipIt(void* buffer);									// Flips The Red And Blue Bytes (256x256)
	};
}
#endif